<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

  <xsl:param name="paramsFile"/>
	<xsl:param name="parameters" select="document($paramsFile)/parameters"/>
	<xsl:template match="node() | @*">
		<xsl:copy>
			<xsl:apply-templates select="node() | @*"/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="if">
		<xsl:variable name="this" select="."/>
		<xsl:variable name="param" select="$parameters/parameter[@key = $this/@key and @value = $this/@value]"/>
		<xsl:for-each select="$param">
			<xsl:apply-templates select="$this/*[name(.)='then']/*"/>
		</xsl:for-each>
		<xsl:if test="not($param)">
			<xsl:apply-templates select="child::else/*"/>
		</xsl:if>
	</xsl:template>

</xsl:stylesheet>
